<?php defined('BASEPATH') or exit('No direct script access allowed');
class Channel_m extends MY_Model
{
	public function __construct(){
		parent::__construct();
		$this->set_table_name("channel");
	}

	public  function getAllByDate($date){
		$dayOfWeek=$date->format("N");
		$sql = "SELECT l.`id`, l.`name`, l.`type`, l.`url`, l.`url1`, l.`url2`"
		." \nFROM `l_channel` l INNER JOIN `l_channel_schedule` s ON l.id = s.channel_id"
		." \nWHERE s.day = ? ";
		
		return $this->db->query($sql, array($dayOfWeek))->result();
	}
}